<?php

$api = app('Dingo\Api\Routing\Router');
$moduleName = 'Category';

// 平台后台api
$api->version('v1', ['prefix' => 'admin-api', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Admin\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'] ;

	$api->resource('{categoryType}/categories', "CategoryController", ['only' => $allMethod]);
	$api->resource('image-tags', "ImageTagController", ['only' => $allMethod]);
});

// 租户api
$api->version('v1', ['prefix' => 'erp', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Erp\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];

	$api->post('/categories', ['uses'=> "CategoryController@store"]);
});

// 普通用户api
$api->version('v1', ['namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Client\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];

	// $api->resource('categories', "CategoryController", ['only' => ['index']]);
	$api->resource('{categoryType}/categories', "CategoryController", ['only' => $allMethod]);

	$api->get('/categories/{idOrUuid}', ['uses'=> "CategoryController@show"]);
});